<% layout('/layouts/list.html', {title: '计划任务', libs: ''}){ %>
<#grid:grid id="schedulejobGrid" url="${adminPath}/task/schedule/job/ajaxList">
    <#grid:column label="sys.common.key" hidden="true"   name="id" width="100"/>
    <#grid:column label="sys.common.opt"  name="opt" formatter="button" width="300"/>
    <#grid:button title="开启"  exp="row.jobStatus==0" tipMsg="你确定要启动该计划任务么?"  groupname="opt" function="rowConfirm" outclass="btn-primary" innerclass="fa-play" url="${adminPath}/task/schedule/job/changeJobStatus?cmd=start" />
    <#grid:button title="停止" exp="row.jobStatus==1" tipMsg="你确定要停止该计划任务么?" groupname="opt" function="rowConfirm" outclass="btn-danger"  innerclass="fa-square-o" url="${adminPath}/task/schedule/job/changeJobStatus?cmd=stop" />
    <#grid:button title="执行一次" tipMsg="你确定要执行一次么?" groupname="opt" function="rowConfirm" outclass="btn-info"  innerclass="fa-play-circle-o" url="${adminPath}/task/schedule/job/runAJobNow" />
    <#grid:button title="更新" exp="row.jobStatus==1"  groupname="opt" outclass="btn-primary" tipMsg="你确定要更新该计划任务么?" function="rowConfirm" innerclass="fa-refresh" url="${adminPath}/task/schedule/job/updateCron" />
    <#grid:column label="任务名称"  name="jobName"   query="true" />
    <#grid:column label="任务分组"  name="jobGroup" width="80"/>
    <#grid:column label="执行类"  name="beanClass"     />
    <#grid:column label="方法名"  name="methodName"    />
    <#grid:column label="方法参数"  name="methodName"    />
    <#grid:column label="执行表达式"  name="cronExpression" />
    <#grid:column label="任务状态"  name="jobStatus" dict="sf"  />
    <#grid:column label="是否同步"  name="isConcurrent" dict="sf" />
    <#grid:column label="创建时间"  name="createTime" />
    <#grid:toolbar  function="add"/>
    <#grid:toolbar  function="update" />
    <#grid:toolbar icon="fa-refresh" title="刷新任务" onclick="refreshJob()" />
    <#grid:toolbar  function="delete" />
    <#grid:toolbar  function="search"  />
    <#grid:toolbar  function="reset" />
</#grid:grid>
<script>
    function refreshJob() {
        swal({
            title: "提示",
            text: "您确定刷新任务，会清空以前的任务！",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "确定",
            closeOnConfirm: false,
            cancelButtonText: "取消",
        }, function () {
            $.ajax({
                url : '${adminPath}/task/schedule/job/refreshJob',
                type : 'post',
                cache : false,
                success : function(d) {
                    if (d.code == 0 || d.code== undefined==0) {
                        var msg = d.msg;
                        swal("提示！", msg, "success");
                    }else{
                        var msg = d.msg;
                        swal("提示！", msg, "error");
                    }
                }
            });
        });
    }
</script>
<% } %>